<template>
	<view>
		<view class="topview">
			<u-search searchIconSize="35" bgColor='#fff' searchIconColor='#1590EF' borderColor='#B5B9CD'
				:showAction="true" placeholder="请输入公司名称" actionText="搜索" :animation="true">
			</u-search>
		</view>
		<!-- 企业信息 -->
		<view style="padding-bottom: 20rpx;">
			<view class="viewpage">
				<text>{{ownerName}}</text>
				<!-- <v-table :columns="columns" :list="data"></v-table> -->
				<uni-table ref="table" border stripe emptyText="暂无更多数据">
					<uni-tr>
						<uni-th width="60" align="center">序号</uni-th>
						<uni-th width="200" align="center">描述</uni-th>
						<uni-th width="90" align="center">有效期至</uni-th>
					</uni-tr>
					<uni-tr v-for="(item, index) in data" :key="index">
						<uni-td align="center">{{ item.id }}</uni-td>
						<uni-td align="center">
							{{ item.warningInfo }}
						</uni-td>
						<uni-td align="center">{{ item.time }}</uni-td>

					</uni-tr>
				</uni-table>
			</view>

		</view>

	</view>
</template>


<script>
	import vTable from '../warning/components/table.vue'
	import {
		jyxkzYq
	} from '@/common/api/req.js'
	export default {
		components: {
			vTable
		},
		data() {
			return {
				objData: {},
				ownerName: '',
				data: [],
				columns: [{
						title: "序号",
						key: "id",
						$width: '40px',

					},
					{
						title: '描述',
						key: 'warningInfo',
						$width: '200px'
					},
					{
						title: '有效期至',
						key: 'time',
						$width: '90px'
					}
				],
				current: 1,
				size: 10,


			};
		},
		onLoad(option) {

			this.objData = JSON.parse(option.item)
			this.ownerName = this.objData.inspObjName

			// uni.setNavigationBarTitle({
			// 	title:inspObjName 
			// });
		},
		mounted() {
			this.getData()
		},
		methods: {
			tabClick() {},
			itemClick(item) {
				this.$goBack('../msgQuery/integral_rule', 2);
			},
			getData() {
				jyxkzYq({
					current: this.current,
					size: 9999,
					ownerId: this.objData.inspObjId, //企业id（从列表获取原样传回来）
					warningCategory: this.objData.warningCategory, //预警分类（从列表获取原样传回来）
					warningType: this.objData.warningType, //预警类型（从列表获取原样传回来）
					warningInfo: this.objData.warningInfo, //预警信息（从列表获取原样传回来）
					carNo: "", //车牌号
					personName: "", //人员名称
					matchType: "" //1/2/3；有运单无轨迹/无运单有轨迹/运单轨迹不符车辆数（预警类型为：电子运单检测异常时需要传该值）
				}).then(res => {
					let data = res.data.data.records
					this.isloading = false
					if (res.data.data.records.length > 0) {
						data.forEach((item, index) => {
							item.id = index + 1
							item.carNo = item.carNo + " (" + item.carColor + ")"
						})
						this.data = data
					} else {
						uni.showToast({
							title: '暂无数据',
							icon: 'none'
						})
					}
				})
			}

		}
	}
</script>

<style lang="scss">
	page {
		background-color: #F7FBFC;
	}

	.topview {
		padding: 10px 15px;
		background-color: #F7FBFC;
		position: sticky;
		z-index: 999;
		top: 0;


		.u-search__content {
			padding: 5px 10px;
		}
	}

	.viewpage {
		// padding: 20rpx;
		text-align: center;
		background-color: #ffffff;
		width: 370px;
		margin: 0 auto;
		// margin-top: 10px;
		padding-top: 20rpx;
		padding-bottom: 20rpx;
		border-radius: 10rpx;
		border: 2rpx #B5B9CD solid;

		text {
			font-size: 34rpx;
		}
	}
</style>
